package h0801;

import java.util.Arrays;
import java.util.Scanner;

/**
  * @description 字符串变换最小字符串
  * @author 不知名帅哥
  * @date 2024/8/1 20:39
  * @version 1.0
*/
public class ChangeStringToMinString {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s = sc.nextLine();
        char[] chars = s.toCharArray();
        String minStr=s;
        for (int i = 0; i < chars.length; i++) {
            for (int j = i+1; j < chars.length; j++) {
                swap(chars,i,j); //交换
                String newStr=new String(chars);
                if (newStr.compareTo(minStr)<0){
                    minStr=newStr;
                }
                swap(chars,i,j);
            }
        }
        System.out.println(minStr);
    }

    private static void swap(char[] chars, int i, int j) {
        char c=chars[i];
        chars[i]=chars[j];
        chars[j]=c;
    }
}
